<template>
  <div id="app">
  <!--    <router-view/>-->
<!--    <router-view v-if="showPage == 1" name="m"></router-view>-->
<!--    <router-view v-if="showPage == 2" name="pc"></router-view>-->
    <router-view :name="showPage"></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  data (){
    return{
      showPage: '',
    }
  },
  created() {
    if(this.isMobile()){
      this.showPage = 'm';
    }else {
      this.showPage = 'pc';
    }
  },
  methods:{
    isMobile(){
      const flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      )
      return flag
    }
  }
}
</script>

<style>
  #app{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
</style>
